<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>12.网页边栏广告效果实现(对联广告实现)</title>
  <style>
  .content{
    width: 100%;
    height: 2000px;
  }
  .img1{
    position: fixed;
    top: 50%;
    left: 0;
  }
  .img2{
    position: fixed;
    top: 50%;
    right:0;
  }
  .img1 img,.img2 img{
    width: 200px;
    border-radius: 4px;
  }
  </style>
</head>
<script src="js/jquery-1.12.4.min.js"></script>
<script>
  $(function(){
    $(window).scroll(function(){
      var distence = $(document).scrollTop();
      console.log('distence', distence);
      if (distence >= 885) {
        $('img').show(1000);
      } else {
        $('img').hide(1000);
      }
    });
  });
</script>
<body>
  <div class="content">
    <div class="img1">
      <img src="https://www.x6d.com/uploads/allimg/201223/1608729944859397.gif" alt="">
    </div>
    <div class="img2">
      <img src="https://www.x6d.com/uploads/allimg/201223/1608729944859397.gif" alt="">
    </div>
  </div>
</body>
</html>